{% extends "sniffbook/base.html" %}
{% block content %}

<form action="/list/" method="POST">
{% csrf_token %}
<table>
{{ new_mat_form }}
</table>
<input type="submit" value="Add" />
</form>

{% if accords %}
<table>
  <tr>
  <td><a href="/list/s=bottle_num">Bottle</a></td>
  <td><a href="/list/s=name">Name</a></td>
  <td>Notes</td>
  <td>On hand (ml)</td>
  <td>Substantivity</td>
  <td>Dilution</td>
  <td>Cost/ml</td>
  </tr>
  {% for a in accords %}
  <tr>
  <td>{{ a.bottle_num|default_if_none:"" }}</td>
  <!-- FIXME needs to be a.key()? -->
  <td><a href="/material/{{a.id}}">{{ a.name }}</a></td>
  <td>{{ a.notes }}</td>
  <td>{{ a.ml_on_hand|floatformat }}</td>
  <td>{{ a.substantivity|floatformat }}</td>
  <td>{{ a.price_ml|floatformat:2 }}</td>
  </tr>
  {% endfor %}
</table>
{% else %}
    <p>Nothing available.</p>
{% endif %}
{% endblock %}
